#ifndef OPPLIB_H_
#define OPPLIB_H_

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

#include "config.h"

/*******************************************************************
  opp_list
 *******************************************************************/

typedef struct opp_list {
  void *data;
  struct opp_list *prev;
  struct opp_list *next;
} opp_list;

opp_list *opp_list_new();
uint8_t opp_list_delete(opp_list * list);
uint8_t opp_list_delete_list_only(opp_list * list);
opp_list *opp_list_first(opp_list * list);
opp_list *opp_list_last(opp_list * list);
void *opp_list_get(opp_list * list, int32_t i);
uint8_t opp_list_set(opp_list * list, int32_t i, void *data);
opp_list *opp_list_append(opp_list * list, void *data);
opp_list *opp_list_prepend(opp_list * list, void *data);
opp_list *opp_list_remove(opp_list * list, int32_t i);
void opp_list_cut(opp_list * list);
void opp_list_cut_list_only(opp_list * list);
uint32_t opp_list_length(opp_list * list);

/*******************************************************************
  opp_node
 *******************************************************************/

typedef struct opp_node {
  void *data;
  struct opp_node *dad;
  struct opp_node *son;
  struct opp_node *pbro;
  struct opp_node *bro;
} opp_node;

opp_node *opp_node_new();
uint8_t opp_node_delete(opp_node * node);
uint8_t opp_node_delete_tree_only(opp_node * node);
uint8_t opp_node_remove(opp_node * node);
opp_node *opp_node_root(opp_node * node);
uint8_t opp_node_set(opp_node * node, void *data);
opp_node *opp_node_add_son(opp_node * node, void *son);
opp_node *opp_node_link_son(opp_node * node, opp_node * son);
opp_node *opp_node_add_bro(opp_node * node, void *bro);
opp_node *opp_node_link_bro(opp_node * node, opp_node * bro);

#endif
